/**   
*    
* @file
* @brief
*
* @<b>文件名</b>      : UserInfoListParser
* @n@n<b>版权所有</b>: 网龙应用软件开发一部
* @n@n<b>作  者</b>  : Administrator
* @n@n<b>创建时间</b>: 2014-2-8 下午3:54:44 
* @n@n<b>文件描述</b>:  
* @version  
*/
package com.common.weibolib;

import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import com.common.android.utils.parser.AbstractArrayParser;

/**
 * ClassName:UserInfoListParser
 * Function: TODO ADD FUNCTION
 * Reason:	 TODO ADD REASON
 * 
 * @author   chenqian		
 * @version  
 * @since    Ver 1.1
 * @Date	 2014	2014-2-8		下午3:54:44
 *
 * @see 	 
 */

public class UserInfoListParser extends AbstractArrayParser<UserInfo> {

	@Override
	public UserInfoList parse(JSONArray array) throws JSONException {
		UserInfoList list = new UserInfoList();
		UserInfoParser uiParser = new UserInfoParser();
		for (int i = 0, len = array.length(); i < len; i++) {
			UserInfo ui = uiParser.parse(array.getJSONObject(i));
			list.add(ui);
		}
		return list;
	}

	@Override
	public JSONArray toJSONArray(List<UserInfo> group) throws JSONException {
		JSONArray array = new JSONArray();
		UserInfoParser uiParser = new UserInfoParser();
		for (UserInfo  ui : group) {
			JSONObject json =uiParser.toJSONObject(ui);
			array.put(json);
		}
		return array;
	}
}
